﻿
using Newtonsoft.Json;
using SqlSugar;
using System.Configuration;
using System.Data;
using System.Linq.Expressions;
using System.Text;

namespace YOUYOU.Core
{
    public class SqlsugarHelper
    {
        public static SqlSugarClient db
        {
            get => new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = "datasource=dm.db",
                DbType = SqlSugar.DbType.Sqlite,
                IsAutoCloseConnection = true
            }, db =>
            {

                db.Aop.OnLogExecuting = (sql, pars) =>
                {

                    //获取原生SQL推荐 5.1.4.63  性能OK
                    Console.WriteLine(UtilMethods.GetNativeSql(sql, pars));
                    //MessageBox.Show(sql);
                    //获取无参数化SQL 对性能有影响，特别大的SQL参数多的，调试使用
                    //Console.WriteLine(UtilMethods.GetSqlString(DbType.SqlServer,sql,pars))


                };
            });
        }
    }
}